/**
 * <p>
 * 表格配置
 *
 * @Author：Roy
 * @Description：数据范围
 * @Date：Create by 2024-01-17 16:55:06
 */
// 隐藏操作按钮的规则配置，字段名：isEdit
const isHidden = (list, row) => {
  const { isEdit } = row || {}
  return list.includes(String(isEdit))
}

const headerConfig = {
  'data-range': [
    {
      prop: 'rangeName',
      name: '角色名称',
      minWidth: 110
    },
    {
      prop: 'rangeCode',
      name: '角色编码',
      minWidth: 110
    },
    {
      prop: 'rangeLevelName',
      name: '范围级别',
      minWidth: 110
    },
    {
      prop: 'remark',
      name: '描述',
      minWidth: 110
    },
    {
      prop: 'status',
      name: '状态',
      componentCell: 'CellSwitch',
      authId: 'ecp-admin:dataRange:enableOrDisable',
      switchConfig: {
        valueTypeProp: 'code',
        dataProp: 'status',
        activeCode: '1',
        activeName: '启用',
        inactiveCode: '2',
        inactiveName: '禁用',
        switchPath: 'dataRange.enableOrDisable',
        switchParamsProp: {
          id: 'id',
          label: 'label',
          value: 'value',
          sort: 'sort',
          dictCode: 'dictCode',
          remark: 'remark',
          name: 'name'
        }
      }
    },
    {
      name: '操作',
      width: 200,
      fixed: 'right',
      thStyle: { 'text-align': 'left' },
      operateList: [
        {
          type: 'btnText',
          label: '详情',
          id: 'data-range-search',
          authId: 'ecp-admin:dataRange:search',
          config: { type: 'text' },
          hidden: (val) => {
            return false // !isHidden(['1'], val)
          }
        },
        {
          type: 'btnText',
          label: '编辑',
          id: 'data-range-edit',
          authId: 'ecp-admin:dataRange:update',
          config: { type: 'text' },
          hidden: (val) => {
            return false // !isHidden(['1'], val)
          }
        },
        {
          type: 'btnText',
          label: '删除',
          id: 'data-range-delete',
          authId: 'ecp-admin:dataRange:deleteById',
          isMore: true,
          config: { type: 'text' },
          style: { color: '#ff0000' },
          hidden: (val) => {
            return false // !isHidden(['1'], val)
          }
        }
      ]
    }
  ]
}

export default {}
export { headerConfig }
